#define _CRT_SECURE_NO_WARNINGS 1
/**
 * Note: The returned array must be malloced, assume caller calls free().
 */
int* masterMind(char* solution, char* guess, int* returnSize)
{
    int* ret = (int*)malloc(sizeof(int) * 2);
    int ra0 = 0;
    int ra1 = 0;
    int i = 0;
    for (i = 0; i < 4; i++)
    {
        if (solution[i] == guess[i])
        {
            ra0++;
        }
    }
    for (i = 0; i < 4; i++)
    {
        int j = 0;
        for (j = 0; j < 4; j++)
        {
            if (guess[j] == solution[i])
            {
                guess[j] = '0';
                ra1++;
                break;
            }
        }
    }
    ret[0] = ra0;
    ret[1] = ra1 - ra0;
    *returnSize = 2;
    return ret;
}
